package net.maergaiyun.controller;


import lombok.extern.slf4j.Slf4j;
import net.maergaiyun.controller.request.ConfirmOrderRequest;
import net.maergaiyun.enums.ClientTypeEnum;
import net.maergaiyun.enums.ProductOrderPayTypeEnum;
import net.maergaiyun.service.ProductService;
import net.maergaiyun.util.CommonUtil;
import net.maergaiyun.util.JsonData;
import net.maergaiyun.vo.ProductVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author maergaiyun
 * @since 2024-09-05
 */
@RestController
@RequestMapping("/api/product/v1")
@Slf4j
public class ProductController {

    @Autowired
    private ProductService productService;

    @GetMapping("list")
    public JsonData list() {
        List<ProductVO> productVOList = productService.list();
        return JsonData.buildSuccess(productVOList);
    }

    @GetMapping("detail/{product_id}")
    public JsonData detail(@PathVariable("product_id") Long productId) {
        ProductVO productVO = productService.findDetailById(productId);
        return JsonData.buildSuccess(productVO);
    }
}

